package net.lovedna.config {
	import flash.utils.Dictionary;
	/**
	 * @author lee
	 */
	public class MessageConfig {
		private var _dict:Dictionary=new Dictionary();
		public function add(id:int,msg:Class,command:Class=null):void{
			if(id<0 || id>65535){
				throw new Error("协议号不能小于0大于65535");
			}
			if(_dict["m"+id]!=undefined){
				throw new Error(id+"已经配制过了。不要重复添加。");
			}
			_dict["m"+id]=msg;
			if(command){
				_dict["c"+id]=command;
			}
		}
		public function getMessage(id:int):Class{
			return _dict["m"+id];
		}
		public function getCommand(id:int):Class{
			return _dict["c"+id];
		}
	}
}
